#import "obgtk.h"
#import <stdio.h>
// Called when the window is closed, otherwise the app would keep running because GTK's loop is still going
static void destroy( GtkWidget *widget,
                     gpointer   data )
{
	[GTK quit];
}
// Called when the mouse hovers over hiButton
// in this function *button is a pointer
// to hiButton, since events send their
// object
static void enable( GtkWidget *widget,
                     id button )
{
	[button sensitive: NO];
	[button label: "No, you can't exit!!!"];
	printf("TEST!");
}
// In the beginning, there was main(), and main() was without form and void
int main( int   argc,
          char *argv[] )
{
	// Reserve some pointers for the widgets
	id mainWindow;
	id hiButton;
	// Now we need to init GTK, since it requrires argc & argv there isn't a GTK method for this
	gtk_init (&argc, &argv);
	// Initalize the main window, set it's title, then set it's border width
	mainWindow = [[[GTKWindow new] title: "Hello, world"] borderWidth: 10];
	// Initalize a button, put a label on it, make it a child of the main window, and put a border on it
	hiButton = [[[[GTKButton new] label: "Exit Hello, World"] parent: mainWindow] borderWidth: 30];
	// Here we have the main window show itself and it's children
	[mainWindow showAll];
	//Connect events to functions
	[mainWindow onDestroy: destroy];
	[hiButton onEnter: enable];
	//Run the GTK loop
	[GTK main];
	return 0;
}
